package xpn.platform.modules.workflow.other.usefulexpression;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.data.rest.core.annotation.RestResource;
import org.springframework.data.rest.core.config.Projection;
import xpn.platform.modules.sys.user.SysUser;

import java.util.List;

@RepositoryRestResource(path = "workflow_useful_expressions", excerptProjection = UsefulExpressionProjection.class)
public interface UsefulExpressionDAO extends JpaRepository<UsefulExpression, Long> {

    @RestResource(path = "findByUser")
    List<UsefulExpression> findByUser(@Param("user") SysUser user);
}

@Projection(name = "default", types = {UsefulExpression.class})
interface UsefulExpressionProjection {
    String getContent();

    Float getSortNo();
}